#ifndef CDGWIDGETBASE_H
#define CDGWIDGETBASE_H

#include <qstring.h>

// Audio things
#include <mythtv/audiooutput.h>
class Output;
class Decoder;

#include "CDGlib.h"

//50 frames/sec
const int animTimer = 20;


class CDGWidgetBase
{
  public:
    CDGWidgetBase();
    virtual ~CDGWidgetBase(void) = 0;

    virtual bool play(const QString& filename,
                      bool useTransp=true,
                      bool useTransBkg=true,
                      bool useTransBorder=true) = 0;
    virtual void stop() = 0;
    virtual void info() = 0;

    void pause();
    void seekforward();
    void seekback();

    void openOutputDevice(QObject *listener);
    void switchTransparency(void);
    void switchTransparentBkg(void);
    bool isActive(void);


 protected:
    void stopDecoder(void);
    void seek(int pos);


    // CDG
    CDGlib m_cdg;
    int    m_parsed;
    QString m_cdgFile;

    //State
    bool m_isactive;
    bool m_isplaying;

    QTimer      *m_timer;
    QIODevice   *m_input;
    AudioOutput *m_output;
    Decoder     *m_decoder;

};

#endif
